package analysis.ProvinceSchoolPlan;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class ProvinceSchoolPlanMapper extends Mapper<LongWritable, Text,Text, IntWritable> {
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String line = value.toString();
        String[] words = line.split(" ");
        String province = words[3]; //省份名称
        int num = Integer.parseInt(words[7]);   // 招生人数
        context.write(new Text(province), new IntWritable(num));
    }
}
